<template>
	<div>
		<div id="sec_nav">
			<h3 style="margin-left: 40px;line-height: 80px;">
				<i class="el-icon-notebook-2"></i>
				门诊病例
			</h3>
		</div>
		<div id="main">
			<el-container>
				<!-- ----------------------------------------------------------------左侧部分的跳转部分---------------------------------------------------------------------- -->
				<el-aside id="main_aside" style="width: 35%;">
					<div style="margin: 10px 0 10px 20px; ">
						<h5 style="margin-bottom: 20px;">选中患者信息：</h5>
						<el-row justify="space-around" style="margin-left: 40px;">
							<el-col style="width: 50%;">病历号：{{currentPatient.medicalRecordId}}</el-col>
							<el-col style="width: 50%;">姓 名：{{currentPatient.patientName}}</el-col>
						</el-row>
					</div>
					<hr>
					<div style="height: 450px;">
						<div>
							<div style="margin: 15px 60px 10px 60px;">
								<el-input v-model="leftsearch" placeholder="输入病历号或姓名关键字索引" />
							</div>
						</div>
						<el-table height="400px"
							:data="tableData.filter(data => !leftsearch || data.medicalRecordId.toLowerCase().includes(leftsearch.toLowerCase())||data.patientName.toLowerCase().includes(leftsearch.toLowerCase()))"
							@current-change="patientSwitch" style="width: 90%;margin-left: 30px;"
							highlight-current-row="true">
							<el-table-column type="index" width="50" label="序列">
							</el-table-column>
							<el-table-column property="medicalRecordId" label="病历号" width="130">
							</el-table-column>
							<el-table-column property="patientName" label="姓名" width="70">
							</el-table-column>
							<el-table-column property="patientAge" label="年龄" width="60">
							</el-table-column>
							<el-table-column label="挂号状态" width="80">
								<template slot-scope="scope">
									<span v-if="scope.row.registerState==='已就诊'" style="color: green">已就诊</span>
									<span v-else-if="scope.row.registerState==='待就诊'" style="color:red;">待就诊</span>
								</template>
							</el-table-column>
						</el-table>
					</div>
				</el-aside>
				<!-- ----------------------------------------------------------------右侧部分的跳转部分---------------------------------------------------------------------- -->
				<el-main id="main_main">
					<el-tabs v-model="activeName" @tab-click="changeClick">
						<!-- ----------------------------------------------------------------病历首页的跳转部分---------------------------------------------------------------------- -->
						<el-tab-pane label="病历首页" name="first">
							<div style="height: 480px;">
								<div style="width: 100%;margin-left: 50px;">
									<el-row type="flex" justify="space-between" style="width: 100%;">
										<el-col>
											<el-button class="myButton" icon="el-icon-circle-plus" @click="homeAdd">
												添加</el-button>
										</el-col>

										<el-col>
											<el-button class="myButton" icon="el-icon-view" @click="homeWatch">查看
											</el-button>
											<el-dialog title="西医诊断信息" :visible.sync="dialogTableVisible">
												<el-table :data="westernMedicine">
													<el-table-column property="ICDCode" label="ICD编码" width="300">
													</el-table-column>
													<el-table-column property="ICDName" label="名称" width="270">
													</el-table-column>
													<el-table-column property="ICDTime" label="发病时间"></el-table-column>
												</el-table>
											</el-dialog>
										</el-col>
										<el-col>
											<el-button class="myButton" icon="el-icon-edit" @click="homeReset">重置
											</el-button>
										</el-col>
									</el-row>
								</div>
								<hr>
								<div style="overflow: auto; height: 450px;">
									<el-form label-width="100px" style="margin: 20px 40px 0 0;">
										<el-form-item>
											<span slot="label">
												<span class="span-box">
													<i class="el-icon-s-order"></i>
													<span> 主 诉: </span>
												</span>
											</span>
											<el-input type="textarea" :rows="1" placeholder="请输入内容"
												v-model="rightTable1.chiefComplaint">
											</el-input>
										</el-form-item>
										<el-form-item>
											<span slot="label">
												<span class="span-box">
													<i class="el-icon-s-order"></i>
													<span> 现病史: </span>
												</span>
											</span>
											<el-input type="textarea" :rows="1" placeholder="请输入内容"
												v-model="rightTable1.presentIll">
											</el-input>
										</el-form-item>
										<el-form-item>
											<span slot="label">
												<span class="span-box">
													<i class="el-icon-s-order"></i>
													<span> 治疗情况: </span>
												</span>
											</span>
											<el-input type="textarea" :rows="1" placeholder="请输入内容"
												v-model="rightTable1.treatment">
											</el-input>
										</el-form-item>
										<el-form-item>
											<span slot="label">
												<span class="span-box">
													<i class="el-icon-s-order"></i>
													<span> 既往史: </span>
												</span>
											</span>
											<el-input type="textarea" :rows="1" placeholder="请输入内容"
												v-model="rightTable1.pastHistory">
											</el-input>
										</el-form-item>
										<el-form-item>
											<span slot="label">
												<span class="span-box">
													<i class="el-icon-s-order"></i>
													<span> 过敏史: </span>
												</span>
											</span>
											<el-input type="textarea" :rows="1" placeholder="请输入内容"
												v-model="rightTable1.allergicHistory">
											</el-input>
										</el-form-item>
										<el-form-item>
											<span slot="label">
												<span class="span-box">
													<i class="el-icon-s-order"></i>
													<span> 体格检查: </span>
												</span>
											</span>
											<el-input type="textarea" :rows="1" placeholder="请输入内容"
												v-model="rightTable1.bodyTest">
											</el-input>
										</el-form-item>
										<el-form-item>
											<span slot="label">
												<span class="span-box">
													<i class="el-icon-s-order"></i>
													<span> 检查建议: </span>
												</span>
											</span>
											<el-input type="textarea" :rows="1" placeholder="请输入内容"
												v-model="rightTable1.testAdvice">
											</el-input>
										</el-form-item>
										<el-form-item>
											<span slot="label">
												<span class="span-box">
													<i class="el-icon-s-order"></i>
													<span> 注意事项: </span>
												</span>
											</span>
											<el-input type="textarea" :rows="1" placeholder="请输入内容"
												v-model="rightTable1.attentionThing">
											</el-input>
										</el-form-item>
										<el-card class="box-card" style="margin: 20px 0 20px 0;height: 400px;">
											<el-container slot="header" class="clearfix">
												<span style="float: left; line-height: 40px;">西医诊断：</span>
												<span style="margin: 0 10px 0 130px; width: 300px;">
													<el-input v-model="westernMedicineSearch"
														placeholder="输入IDC编码或名称关键字索引" />
												</span>
											</el-container>
											<el-table style="width: 100%" @selection-change="westernSelectChange"
												:data="rightTable1.westernMedicine.filter(data => !westernMedicineSearch || data.ICDCode.toLowerCase().includes(westernMedicineSearch.toLowerCase())||data.ICDName.toLowerCase().includes(westernMedicineSearch.toLowerCase()))">
												<el-table-column type="selection" width="60">
												</el-table-column>
												<el-table-column prop="ICDCode" label="ICD编码" width="180">
												</el-table-column>
												<el-table-column prop="ICDName" label="名称" width="180">
												</el-table-column>
												<el-table-column prop="ICDTime" label="发病时间" show-overflow-tooltip
													width="180">
												</el-table-column>
											</el-table>
										</el-card>
									</el-form>
								</div>
							</div>
						</el-tab-pane>
						<!-- ----------------------------------------------------------------检查申请页面的跳转部分---------------------------------------------------------------------- -->
						<el-tab-pane label="检查申请" name="second">
							<div style="width: 100%;margin-left: 50px;">
								<el-row type="flex" justify="space-between" style="width: 100%;">
									<el-col>
										<el-button class="myButton" @click="inspectionAdd"
											icon="el-icon-circle-plus-outline">添加</el-button>
									</el-col>
									<el-col>
										<el-button class="myButton" @click="inspectionDelete"
											icon="el-icon-remove-outline">删除</el-button>
									</el-col>
									<el-col>
										<el-button class="myButton" @click="inspectionApply" icon="el-icon-success">申请
										</el-button>
									</el-col>
								</el-row>
							</div>
							<hr>
							<div style="height: 400px;">
								<div style="margin: 20px 0 10px 0;">
									申请名称：
									<el-input v-model="rightTable2.nameOfApplication" style="width: 80%;"></el-input>
								</div>
								<div style="overflow: auto; height: 405px; margin-top: -10px;">
									<div style="margin: 20px 0 20px 0;">
										项目检索：
										<el-input v-model="inspectionSearch1" placeholder="输入项目编号或项目名称索引"
											style="width: 82%;" />
									</div>
									<el-table @selection-change="inspectionSelectionChange"
										:data="rightTable2.inspectionAdd.filter(data => !inspectionSearch1 || data.entryId.toLowerCase().includes(inspectionSearch1.toLowerCase())||data.entryName.toLowerCase().includes(inspectionSearch1.toLowerCase()))"
										@current-change="handleCurrentChange" style="width: 100%;" height="390px">
										<el-table-column type="selection" width="60">
										</el-table-column>
										<el-table-column property="entryId" label="项目编号" width="140">
										</el-table-column>
										<el-table-column property="entryName" label="项目名称" width="140">
										</el-table-column>

										<el-table-column label="执行科室" width="130">
											<template slot-scope="scope">
												<el-select v-model='scope.row.selectedExecutiveDepartment'>
													<el-option v-for="item in scope.row.executiveDepartment"
														:key="item.departmentNumber" :label="item.departmentNumber"
														:value="item.departmentNumber"></el-option>
												</el-select>
											</template>
										</el-table-column>
										<el-table-column label="是否加急" width="130">
											<template slot-scope="scope">
												<el-select v-model='scope.row.selectedUrgent'>
													<el-option v-for="item in scope.row.Urgent" :key="item.judge"
														:label="item.judge" :value="item.judge"></el-option>
												</el-select>
											</template>
										</el-table-column>
										<el-table-column property="unitPrice" label="单价" width="100">
										</el-table-column>
									</el-table>
									<hr color="#409EFF" style="margin: 25px 0 15px 0;">
									<span>申请项目核对审查表：</span>
									<el-table :data="rightTable2.inspectionTable"
										@selection-change="currentIspectionChange" style="width: 100%;"
										highlight-current-row="true" height="350px">
										<el-table-column type="selection" width="60">
										</el-table-column>
										<el-table-column property="entryId" label="项目编号" width="100">
										</el-table-column>
										<el-table-column property="entryName" label="项目名称" width="80">
										</el-table-column>
										<el-table-column property="selectedExecutiveDepartment" label="执行科室"
											width="120">
										</el-table-column>
										<el-table-column property="selectedUrgent" label="是否加急" width="90">
										</el-table-column>
										<el-table-column property="executiveStatus" label="执行状态" width="90">
										</el-table-column>
										<el-table-column property="inspectionResult" label="检查结果" width="90">
										</el-table-column>
										<el-table-column property="unitPrice" label="单价" width="80">
										</el-table-column>
									</el-table>

								</div>
							</div>
						</el-tab-pane>
						<!-- ----------------------------------------------------------------检验申请页面的跳转部分---------------------------------------------------------------------- -->
						<el-tab-pane label="检验申请" name="third">
							<div style="width: 100%;margin-left: 50px;">
								<el-row type="flex" justify="space-between" style="width: 100%;">
									<el-col>
										<el-button class="myButton" @click="testAdd" icon="el-icon-circle-plus-outline">
											添加</el-button>
									</el-col>
									<el-col>
										<el-button class="myButton" @click="testDelete" icon="el-icon-remove-outline">删除
										</el-button>
									</el-col>
									<el-col>
										<el-button class="myButton" @click="testApply" icon="el-icon-success">申请
										</el-button>
									</el-col>
								</el-row>
							</div>
							<hr>
							<div style="height: 400px;">
								<div style="margin: 20px 0 10px 0;">
									申请名称：
									<el-input v-model="rightTable3.nameOfApplication" style="width: 80%;"></el-input>
								</div>
								<div style="overflow: auto; height: 405px; margin-top: -10px;">
									<div style="margin: 20px 0 20px 0;">
										项目检索：
										<el-input v-model="testSearch" placeholder="输入项目编号或项目名称索引"
											style="width: 82%;" />
									</div>
									<el-table @selection-change="testSelectionChange"
										:data="rightTable3.testAdd.filter(data => !testSearch || data.entryId.toLowerCase().includes(testSearch.toLowerCase())||data.entryName.toLowerCase().includes(testSearch.toLowerCase()))"
										@current-change="handleCurrentChange" style="width: 100%;" height="390px">
										<el-table-column type="selection" width="60">
										</el-table-column>
										<el-table-column property="entryId" label="项目编号" width="140">
										</el-table-column>
										<el-table-column property="entryName" label="项目名称" width="140">
										</el-table-column>

										<el-table-column label="执行科室" width="130">
											<template slot-scope="scope">
												<el-select v-model='scope.row.selectedExecutiveDepartment'>
													<el-option v-for="item in scope.row.executiveDepartment"
														:key="item.departmentNumber" :label="item.departmentNumber"
														:value="item.departmentNumber"></el-option>
												</el-select>
											</template>
										</el-table-column>
										<el-table-column label="是否加急" width="130">
											<template slot-scope="scope">
												<el-select v-model='scope.row.selectedUrgent'>
													<el-option v-for="item in scope.row.Urgent" :key="item.judge"
														:label="item.judge" :value="item.judge"></el-option>
												</el-select>
											</template>
										</el-table-column>
										<el-table-column property="unitPrice" label="单价" width="100">
										</el-table-column>
									</el-table>
									<hr color="#409EFF" style="margin: 25px 0 15px 0;">
									<span>申请项目核对审查表：</span>
									<el-table :data="rightTable3.testTable" @selection-change="currentTestChange"
										style="width: 100%;" highlight-current-row="true" height="350px">
										<el-table-column type="selection" width="60">
										</el-table-column>
										<el-table-column property="entryId" label="项目编号" width="100">
										</el-table-column>
										<el-table-column property="entryName" label="项目名称" width="80">
										</el-table-column>
										<el-table-column property="selectedExecutiveDepartment" label="执行科室"
											width="120">
										</el-table-column>
										<el-table-column property="selectedUrgent" label="是否加急" width="90">
										</el-table-column>
										<el-table-column property="executiveStatus" label="执行状态" width="90">
										</el-table-column>
										<el-table-column property="testResult" label="检查结果" width="90">
										</el-table-column>
										<el-table-column property="unitPrice" label="单价" width="80">
										</el-table-column>
									</el-table>

								</div>
							</div>
						</el-tab-pane>
						<!-- ----------------------------------------------------------------门诊确认页面的跳转部分---------------------------------------------------------------------- -->
						<el-tab-pane label="门诊确认" name="fourth" style="height: 480px;">
							<div style="width: 100%;margin-left: 20%;">
								<el-row type="flex" justify="space-between" style="width: 100%;">
									<el-col>
										<el-button class="myButton" @click="confirmSave" icon="el-icon-edit">保存
										</el-button>
									</el-col>
									<el-col>
										<el-button class="myButton" @click="confirmReset" icon="el-icon-edit">重填
										</el-button>
									</el-col>
								</el-row>
							</div>

							<div style="overflow: auto; height: 450px;">
								<el-form label-width="100px" style="margin: 20px 40px 0 0;">
									<el-form-item>
										<span slot="label">
											<span class="span-box">
												<i class="el-icon-s-order"></i>
												<span> 病 历 号: </span>
											</span>
										</span>
										<el-input :rows="1" placeholder="请输入内容" v-model="rightTable4.medicalrecordId">
										</el-input>
									</el-form-item>
									<el-form-item>
										<span slot="label">
											<span class="span-box">
												<i class="el-icon-s-order"></i>
												<span> 姓 名: </span>
												<el-table
													:data="rightTable2.inspectionAdd.filter(data => !inspectionSearch || data.entryId.toLowerCase().includes(inspectionSearch.toLowerCase())||data.ICDName.toLowerCase().includes(inspectionSearch.toLowerCase()))"
													</span>
											</span>
											<el-input :rows="1" placeholder="请输入内容" v-model="rightTable4.patientName">
											</el-input>
									</el-form-item>
									<el-form-item>
										<span slot="label">
											<span class="span-box">
												<i class="el-icon-s-order"></i>
												<span> 性 别: </span>
											</span>
										</span>
										<el-select style="float: left;" placeholder="请选择性别"
											v-model="rightTable4.patientSex">
											<el-option label="男" value="男">男</el-option>
											<el-option label="女" value="女">女</el-option>
										</el-select>

									</el-form-item>
									<!-- 性别 -->
									<el-form-item>
										<span slot="label">
											<span class="span-box">
												<i class="el-icon-s-order"></i>
												<span> 年 龄: </span>
											</span>
										</span>
										<el-input :rows="1" placeholder="请输入内容" v-model="rightTable4.patientAge">
										</el-input>
									</el-form-item>
									<el-form-item>
										<span slot="label">
											<span class="span-box">
												<i class="el-icon-s-order"></i>
												<span> 检 查: </span>
											</span>
										</span>
										<el-input type="textarea" :rows="3" placeholder="请输入内容"
											v-model="rightTable4.patientCheck">
										</el-input>
									</el-form-item>
									<el-form-item>
										<span slot="label">
											<span class="span-box">
												<i class="el-icon-s-order"></i>
												<span> 诊 断: </span>
											</span>
										</span>
										<el-input type="textarea" :rows="3" placeholder="请输入内容"
											v-model="rightTable4.patientDignose">
										</el-input>
									</el-form-item>
									<el-form-item>
										<span slot="label">
											<span class="span-box">
												<i class="el-icon-s-order"></i>
												<span> 处理意见: </span>
											</span>
										</span>
										<el-input type="textarea" :rows="3" placeholder="请输入内容"
											v-model="rightTable4.dealAdvice">
										</el-input>
									</el-form-item>

								</el-form>
							</div>
						</el-tab-pane>
						<!-- ----------------------------------------------------------------处置申请申请页面的跳转部分---------------------------------------------------------------------- -->
						<el-tab-pane label="处置申请" name="fifth">
							<div style="width: 100%;margin-left: 50px;">
								<el-row type="flex" justify="space-between" style="width: 100%;">
									<el-col>
										<el-button class="myButton" @click="manageAdd"
											icon="el-icon-circle-plus-outline">添加</el-button>
									</el-col>
									<el-col>
										<el-button class="myButton" @click="manageDelete" icon="el-icon-remove-outline">
											删除</el-button>
									</el-col>
									<el-col>
										<el-button class="myButton" @click="manageApply" icon="el-icon-success">申请
										</el-button>
									</el-col>
								</el-row>
							</div>
							<hr>
							<div style="height: 400px;">
								<div style="margin: 20px 0 10px 0;">
									申请名称：
									<el-input v-model="rightTable5.nameOfApplication" style="width: 80%;"></el-input>
								</div>
								<div style="overflow: auto; height: 405px; margin-top: -10px;">
									<div style="margin: 20px 0 20px 0;">
										项目检索：
										<el-input v-model="manageSearch" placeholder="输入项目编号或项目名称索引"
											style="width: 82%;" />
									</div>
									<el-table @selection-change="manageSelectionChange"
										:data="rightTable5.manageAdd.filter(data => !manageSearch || data.entryId.toLowerCase().includes(manageSearch.toLowerCase())||data.entryName.toLowerCase().includes(manageSearch.toLowerCase()))"
										style="width: 100%;" height="390px">
										<el-table-column type="selection" width="60">
										</el-table-column>
										<el-table-column property="entryId" label="项目编号" width="140">
										</el-table-column>
										<el-table-column property="entryName" label="项目名称" width="140">
										</el-table-column>

										<el-table-column label="执行科室" width="130">
											<template slot-scope="scope">
												<el-select v-model='scope.row.selectedExecutiveDepartment'>
													<el-option v-for="item in scope.row.executiveDepartment"
														:key="item.departmentNumber" :label="item.departmentNumber"
														:value="item.departmentNumber"></el-option>
												</el-select>
											</template>
										</el-table-column>
										<el-table-column label="是否加急" width="130">
											<template slot-scope="scope">
												<el-select v-model='scope.row.selectedUrgent'>
													<el-option v-for="item in scope.row.Urgent" :key="item.judge"
														:label="item.judge" :value="item.judge"></el-option>
												</el-select>
											</template>
										</el-table-column>
										<el-table-column property="unitPrice" label="单价" width="100">
										</el-table-column>
									</el-table>
									<hr color="#409EFF" style="margin: 25px 0 15px 0;">
									<span>申请项目核对审查表：</span>
									<el-table :data="rightTable5.manageTable" @selection-change="currentManageChange"
										style="width: 100%;" highlight-current-row="true" height="350px">
										<el-table-column type="selection" width="60">
										</el-table-column>
										<el-table-column property="entryId" label="项目编号" width="100">
										</el-table-column>
										<el-table-column property="entryName" label="项目名称" width="80">
										</el-table-column>
										<el-table-column property="selectedExecutiveDepartment" label="执行科室"
											width="120">
										</el-table-column>
										<el-table-column property="selectedUrgent" label="是否加急" width="90">
										</el-table-column>
										<el-table-column property="executiveStatus" label="执行状态" width="90">
										</el-table-column>
										<el-table-column property="manageResult" label="检查结果" width="90">
										</el-table-column>
										<el-table-column property="unitPrice" label="单价" width="80">
										</el-table-column>
									</el-table>

								</div>
							</div>
						</el-tab-pane>
						<!-- ----------------------------------------------------------------开具药方页面的跳转部分---------------------------------------------------------------------- -->
						<el-tab-pane label="开具药方" name="six">
							<div>
								<div style="width: 100%;margin: 0 0 20px 50px;">
									<el-row type="flex" justify="space-between" style="width: 100%;">
										<el-col>
											<el-button class="myButton" @click = "drugsAdd" icon="el-icon-circle-plus-outline">新增
											</el-button>
										</el-col>
										<el-col>
											<el-button class="myButton" @click="drugsDelete" icon="el-icon-remove-outline">删除</el-button>
										</el-col>
										<el-col>
											<el-button class="myButton" @click = "drugsApply" icon="el-icon-success">提交</el-button>
										</el-col>
									</el-row>
								</div>
								<div style="overflow: auto; height: 420px;">
									<div class="left_kjyf1">
										<div style="margin: 0px 0 0px 0;">
											<el-row>
												<el-col :span="6">
													<span>药品选择</span>
												</el-col>
												<el-col :span="16" class="elcol">
													<el-input style="width: 80%; margin-left: 112px;"
														placeholder="请输入药品名称或编号搜索" v-model="drugSearch">
														<template slot="append"><i
																class="el-icon-search"></i></template>
													</el-input>
												</el-col>
											</el-row>
										</div>
										<el-table 
											:data="rightTable6.overviewOfDrugs.filter(data => !drugSearch || data.drugsId.toLowerCase().includes(drugSearch.toLowerCase())||data.drugsName.toLowerCase().includes(drugSearch.toLowerCase()))"
											@selection-change="drugsSelectionChange"
											style="width: 100%;" highlight-current-row="true" height="80%">
											<el-table-column type="selection" width="60">
											</el-table-column>
											<el-table-column property="drugsId" label="药品编码" width="140">
											</el-table-column>
											<el-table-column property="drugsName" label="药品名称" width="140">
											</el-table-column>
											<el-table-column property="drugsFormat" label="药品规格" width="80">
											</el-table-column>
											<el-table-column property="drugsUnit" label="包装单位" width="100">
											</el-table-column>
											<el-table-column property="manufacturer" label="生产厂家" width="100">
											</el-table-column>
											<el-table-column property="drugsTypeId" label="药品类型" width="100">
											</el-table-column>
											<el-table-column property="drugsPrice" label="单价" width="100">
											</el-table-column>
										</el-table>
									</div>
									<div class="left_kjyf2">
										<div>
											处方详情
										</div>
										<el-table @selection-change="currentDrugsChange" :data="rightTable6.prescriptionDetails"
											style="width: 100%;" highlight-current-row="true" height="90%">
											<el-table-column type="selection" width="60">
											</el-table-column>
											<el-table-column property="drugsId" label="药品名称" width="140">
											</el-table-column>
											<el-table-column property="drugsName" label="药品名称" width="200">
											</el-table-column>
											<el-table-column property="drugsFrequency" label="频率" width="120">
												<template slot-scope="scope">
													<el-input v-model="scope.row.drugsFrequency" placeholder="请输入" />
												</template>
											</el-table-column>
											<el-table-column property="dosage" label="药量" width="120">
												<template slot-scope="scope">
													<el-input v-model="scope.row.dosage" placeholder="请输入" />
												</template>
											</el-table-column>
											<el-table-column property="drugsPrice" label="单价" width="60">
											</el-table-column>
										</el-table>
									</div>
								</div>
							</div>
						</el-tab-pane>
						<!-- ---------------------------确认提交 -------------------------->
						<el-tab-pane label="确认提交" name="seven">
							确认总览
						</el-tab-pane>
					</el-tabs>
				</el-main>
			</el-container>
		</div>
	</div>

</template>

<script>
	export default {
		data() {
			return {
				//-----------------------左侧main的数据
				leftsearch: '',
				tableData: [],
				//当前选中的患者对象 左侧
				currentPatient: {
					medicalRecordId: "",
					patientName: "",
					patientAge: "",
					registerState: "",
				},

				//--------------------右1 main的数据 病历首页
				rightTable1: "",
				//搜索框
				westernMedicineSearch: '',
				//右一 当前选中的西医诊断信息
				westernMedicineMessage: [{
					ICDCode: "",
					ICDName: "",
					ICDTime: ""
				}],
				//右一 展示的西医诊断情况
				westernMedicine: [{
					ICDCode: "",
					ICDName: "",
					ICDTime: ""
				}],
				//右一 模态框查看患者西医诊断信息
				dialogTableVisible: false,


				//----------------右2 main的数据 检查申请
				rightTable2: '',
				inspectionSearch1: '',
				//右二 当前选择添加的信息
				inspectAddSelected: [],
				//右二 充当跳板
				inspectionMedium: "",
				//右二 当前选择要删除的信息
				inspectionDeleteSelected: [],
				//右二 当前已经加入的信息
				inspectionCurrent: [],
				//----------------右3main的数据 检验申请
				rightTable3: '',
				testSearch: '',
				//右三 当前选择添加的信息
				testAddSelected: [],
				//右三 充当跳板
				testMedium: "",
				//右三 当前选择要删除的信息
				testDeleteSelected: [],
				//右三 当前已经加入的信息
				testCurrent: [],

				//右4main的数据 门诊确认
				rightTable4: '',

				//-----------------右5main的数据 处置申请
				rightTable5: '',
				manageSearch: '',
				//右五 当前选择添加的信息
				manageAddSelected: [],
				//右五 充当跳板
				manageMedium: "",
				//右五 当前选择要删除的信息
				manageDeleteSelected: [],
				//右五 当前已经加入的信息
				manageCurrent: [],


				//右6main的数据 开具药方
				drugSearch: '',
				rightTable6: '',
				//右六 当前选择添加的信息
				drugsAddSelected: [],
				//右六 充当跳板
				drugsMedium: "",
				//右六 当前选择要删除的信息
				drugsDeleteSelected: [],
				//右六 当前已经加入的信息
				drugsCurrent: [],


				//Tabs标签页 
				activeName: 'first',


			}
		},
		//json大法
		mounted: function() {
			//左侧
			this.$axios.get('http://localhost:8080/jsonFiles/doctorDiagnosis/MZYS_HZBL_table1.json').then((result) => {
				this.tableData = result.data;
			}).catch((err) => {
				console.log(err);
			});
			//右一
			this.$axios.get('http://localhost:8080/jsonFiles/doctorDiagnosis/MZYS_HZBL_table2.json').then((result) => {
				this.rightTable1 = result.data;
			}).catch((err) => {
				console.log(err);
			});
			//右二	
			this.$axios.get('http://localhost:8080/jsonFiles/doctorDiagnosis/MZYS_HZBL_table3.json').then((result) => {
				this.rightTable2 = result.data;
			}).catch((err) => {
				console.log(err);
			});
			//右3
			this.$axios.get('http://localhost:8080/jsonFiles/doctorDiagnosis/MZYS_HZBL_table4.json').then((result) => {
				this.rightTable3 = result.data;
			}).catch((err) => {
				console.log(err);
			});
			//右4
			this.$axios.get('http://localhost:8080/jsonFiles/doctorDiagnosis/MZYS_HZBL_table5.json').then((result) => {
				this.rightTable4 = result.data;
			}).catch((err) => {
				console.log(err);
			});
			//右5
			this.$axios.get('http://localhost:8080/jsonFiles/doctorDiagnosis/MZYS_HZBL_table6.json').then((result) => {
				this.rightTable5 = result.data;
			}).catch((err) => {
				console.log(err);
			});
			//右6
			this.$axios.get('http://localhost:8080/jsonFiles/doctorDiagnosis/MZYS_HZBL_table7.json').then((result) => {
				this.rightTable6 = result.data;
			}).catch((err) => {
				console.log(err);
			});
		},

		methods: {
			//左侧禁用与选中的选项
			checkSelect(row) {
				return row.status == '待就诊';
			},
			//左侧选择切换病人
			patientSwitch(val) {
				if (val.registerState == "已就诊") {
					this.$message({
						showClose: true,
						message: '请重新选择待就诊状态的患者进行诊断吧',
						type: 'warning'
					});
					this.currentPatient.medicalRecordId = null;
					this.currentPatient.patientName = null;
					this.currentPatient.patientAge = null;
					this.currentPatient.registerState = null;
				} else {
					this.currentPatient.medicalRecordId = val.medicalRecordId;
					this.currentPatient.patientName = val.patientName;
					this.currentPatient.patientAge = val.patientAge;
					this.currentPatient.registerState = val.registerState;
					this.rightTable4.medicalrecordId = this.currentPatient.medicalRecordId;
					this.rightTable4.patientName = this.currentPatient.patientName;
					this.rightTable4.patientAge = this.currentPatient.patientAge;
					this.rightTable4.patientSex = this.currentPatient.patientSex;
					this.$message({
						showClose: true,
						message: '选择患者成功，请在右侧填写诊断信息',
						type: 'success'
					});
				}

			},

			//按钮触发函数 右一
			westernSelectChange(val) {
				this.westernMedicineMessage = val;
			},
			homeReset() {
				this.westernMedicine = null;
			},
			homeAdd() {
				let re = false;
				if (this.westernMedicineMessage.length > 0) {
					for (let s of this.westernMedicineMessage) {
						for (let w of this.westernMedicine) {
							if (s.ICDCode == w.ICDCode) {
								re = true;
								this.$message.error('请不要重复选择诊断类型  IDC编码为' + s.ICDCode);
								break;
							}
						}
						if (!re) {
							this.$message({
								showClose: true,
								message: '添加成功',
								type: 'success'
							});
							this.westernMedicine.push(s);
						}

					}
				} else this.$message.error('请选择要添加的诊断类型');
			},
			homeWatch() {
				this.dialogTableVisible = true;
			},

			//---------------------------------------右2
			inspectionSelectionChange(val) {
				this.inspectAddSelected = val;
			},
			currentIspectionChange(val) {
				this.inspectionDeleteSelected = val;
			},
			inspectionAdd() {
				let re = false;
				if (this.inspectAddSelected.length > 0) {
					for (let s of this.inspectAddSelected) {
						for (let w of this.inspectionCurrent) {
							if (s.entryId == w.entryId) {
								re = true;
								this.$message.error('请不要添加重复的项目类型  项目编号为' + s.entryId);
								break;
							}
						}
						if (!re) {
							if (s.selectedExecutiveDepartment == "" || s.selectedUrgent == "") {
								this.$message({
									showClose: true,
									message: '请选择执行科室和是否加急',
									type: 'warning'
								});
							} else {
								this.$message({
									showClose: true,
									message: '添加成功',
									type: 'success'
								});
								this.inspectionMedium = s;
								this.inspectionMedium.executiveStatus = "待执行";
								this.inspectionMedium.inspectionResult = "暂无结果";
								this.inspectionCurrent.push(this.inspectionMedium);
								this.rightTable2.inspectionTable = this.inspectionCurrent;
							}

						}

					}
				} else {
					this.$message.error('请选择您要添加的项目');
				}
			},

			inspectionDelete() {
				if (this.inspectionDeleteSelected.length > 0) {
					for (let r = 0; r < this.inspectionDeleteSelected.length; r++) {
						for (let w = 0; w < this.inspectionCurrent.length; w++) {
							if (this.inspectionDeleteSelected[r].entryId == this.inspectionCurrent[w].entryId) {
								this.inspectionCurrent.splice(w, 1);
								this.$message({
									showClose: true,
									message: '删除成功',
									type: 'success'
								});
								this.rightTable2.inspectionTable = this.inspectionCurrent;
							}
						}
					}
				} else {
					this.$message.error('请选择您要删除的项目');
				}
			},

			inspectionApply() {
				this.$message({
					showClose: true,
					message: '您的申请已送达',
					type: 'success'
				});
			},

			//--------------------------------------------右三
			testSelectionChange(val) {
				this.testAddSelected = val;
			},
			currentTestChange(val) {
				this.testDeleteSelected = val;
			},
			testAdd() {
				let re = false;
				if (this.testAddSelected.length > 0) {
					for (let s of this.testAddSelected) {
						for (let w of this.testCurrent) {
							if (s.entryId == w.entryId) {
								re = true;
								this.$message.error('请不要添加重复的项目类型  项目编号为' + s.entryId);
								break;
							}
						}
						if (!re) {
							if (s.selectedExecutiveDepartment == "" || s.selectedUrgent == "") {
								this.$message({
									showClose: true,
									message: '请选择执行科室和是否加急',
									type: 'warning'
								});
							} else {
								this.$message({
									showClose: true,
									message: '添加成功',
									type: 'success'
								});
								this.testMedium = s;
								this.testMedium.executiveStatus = "待执行";
								this.testMedium.testResult = "暂无结果";
								this.testCurrent.push(this.testMedium);
								this.rightTable3.testTable = this.testCurrent;
							}

						}

					}
				} else {
					this.$message.error('请选择您要添加的项目');
				}
			},
			testDelete() {
				if (this.testDeleteSelected.length > 0) {
					for (let r = 0; r < this.testDeleteSelected.length; r++) {
						for (let w = 0; w < this.testCurrent.length; w++) {
							if (this.testDeleteSelected[r].entryId == this.testCurrent[w].entryId) {
								this.testCurrent.splice(w, 1);
								this.$message({
									showClose: true,
									message: '删除成功',
									type: 'success'
								});
								this.rightTable2.testTable = this.testCurrent;
							}
						}
					}
				} else {
					this.$message.error('请选择您要删除的项目');
				}
			},
			testApply() {
				this.$message({
					showClose: true,
					message: '您的申请已送达',
					type: 'success'
				});
			},

			//--------------------------------------------右四
			confirmSave() {

				this.$message({
					showClose: true,
					message: '成功保存',
					type: 'success'
				});
			},
			confirmReset() {
				this.rightTable4 = "";
				this.$message({
					showClose: true,
					message: '已重置，请重新填写吧',
					type: 'success'
				});
			},


			//--------------------------------------------右五
			manageSelectionChange(val) {
				this.manageAddSelected = val;
			},
			currentManageChange(val) {
				this.manageDeleteSelected = val;
			},
			manageAdd() {
				let re = false;
				if (this.manageAddSelected.length > 0) {
					for (let s of this.manageAddSelected) {
						for (let w of this.manageCurrent) {
							if (s.entryId == w.entryId) {
								re = true;
								this.$message.error('请不要添加重复的项目类型  项目编号为' + s.entryId);
								break;
							}
						}
						if (!re) {
							if (s.selectedExecutiveDepartment == "" || s.selectedUrgent == "") {
								this.$message({
									showClose: true,
									message: '请选择执行科室和是否加急',
									type: 'warning'
								});
							} else {
								this.$message({
									showClose: true,
									message: '添加成功',
									type: 'success'
								});
								this.manageMedium = s;
								this.manageMedium.executiveStatus = "待执行";
								this.manageMedium.manageResult = "暂无结果";
								this.manageCurrent.push(this.manageMedium);
								this.rightTable5.manageTable = this.manageCurrent;
							}

						}

					}
				} else {
					this.$message.error('请选择您要添加的项目');
				}
			},
			manageDelete() {
				if (this.manageDeleteSelected.length > 0) {
					for (let r = 0; r < this.manageDeleteSelected.length; r++) {
						for (let w = 0; w < this.manageCurrent.length; w++) {
							if (this.manageDeleteSelected[r].entryId == this.manageCurrent[w].entryId) {
								this.manageCurrent.splice(w, 1);
								this.$message({
									showClose: true,
									message: '删除成功',
									type: 'success'
								});
								this.rightTable5.manageTable = this.manageCurrent;
							}
						}
					}
				} else {
					this.$message.error('请选择您要删除的项目');
				}
			},
			manageApply() {
				this.$message({
					showClose: true,
					message: '您的申请已送达',
					type: 'success'
				});
			},
			//右六 
			drugsSelectionChange(val) {
				this.drugsAddSelected = val;
			},
			currentDrugsChange(val) {
				this.drugsDeleteSelected = val;
			},
			drugsAdd() {
				let re = false;
				if (this.drugsAddSelected.length > 0) {
					for (let s of this.drugsAddSelected) {
						for (let w of this.drugsCurrent) {
							if (s.drugsId == w.drugsId) {
								re = true;
								this.$message.error('请不要添加重复的药品  药品编号为' + s.drugsId);
								break;
							}
						}
						if (!re) {
							this.drugsMedium = s;
							this.drugsMedium.drugsFrequency = "";
							this.drugsMedium.dosage = "";
							this.drugsMedium.drugsId = s.drugsId;
							this.drugsMedium.drugsName = s.drugsName;
							this.drugsMedium.drugsPrice = s.drugsPrice;
							this.drugsCurrent.push(this.drugsMedium);
							this.rightTable6.prescriptionDetails = this.drugsCurrent;
							this.$message({
								showClose: true,
								message: '添加成功',
								type: 'success'
							});
						}
					}
				} 
				else 
				{
					this.$message.error('请选择您要添加的药品');
				}
			},
			drugsDelete() {
				if (this.drugsDeleteSelected.length > 0) {
					for (let r = 0; r < this.drugsDeleteSelected.length; r++) {
						for (let w = 0; w < this.drugsCurrent.length; w++) {
							if (this.drugsDeleteSelected[r].entryId == this.drugsCurrent[w].entryId) {
								this.drugsCurrent.splice(w, 1);
								this.$message({
									showClose: true,
									message: '删除成功',
									type: 'success'
								});
								this.rightTable6.prescriptionDetails = this.drugsCurrent;
							}
						}
					}
				} else {
					this.$message.error('请选择您要删除的项目');
				}
			},
			drugsApply() {
				this.$message({
					showClose: true,
					message: '您的申请已送达',
					type: 'success'
				});
			},
		}
	}
</script>

<style scoped="scoped">
	.left_kjyf1 {
		height: 400px;
		box-shadow: 0 2px 1px 0 rgba(85, 170, 255, 0.6);
		line-height: 40px;
	}

	.left_kjyf2 {
		height: 400px;
		box-shadow: 0 2px 1px 0 rgba(0, 0, 0, 0.2);
		margin: 10px 0 -5px 0;
	}

	#sec_nav {
		text-align: left;
		width: auto;
		background-color: white;
		height: 80px;
		line-height: 80px;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
	}

	#main {
		margin-top: 20px;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
		height: 600px;

	}

	#main_aside {
		margin: 20px 0 0 20px;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
		height: 100%;
		border-radius: 8px;
	}

	#main_main {
		margin: 20px 20px 0 20px;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
		height: 100%;
		border-radius: 8px;
	}

	.myButton {
		width: 100px;
		border-width: 1px;
		border-color: rgba(85, 170, 255, 0.7);
		background-color: white !important;
		color: #000000 !important;
	}

	.myButton:hover {
		text-transform: uppercase;
		letter-spacing: 4px;
		background: rgba(85, 170, 255, 1);
		box-shadow: 0 0 1px black,
			0 0 2px white,
			0 0 4px white,
			0 0 6px black;
		transition: all 0.2s linear;
	}
</style>
